package com.readpost.controller;


import com.readpost.doman.Entity.SendProperties;
import com.readpost.service.MailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/mail")
public class MailController {

    @Value("${spring.mail.username}")
    private String sendName;

    @Autowired
    private MailService mailService;

    @PostMapping("/send")
    public void sendMail(){
        SendProperties sendProperties = new SendProperties();
        mailService.sendTestMail(sendName,sendProperties.getReceiveName(), sendProperties.getTitle(), sendProperties.getContent());
    }

}
